package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.come.bean.ChatBean;
import org.come.entity.Friendtable;
import org.come.until.AnalysisString;
import org.come.until.MessagrFlagUntil;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.RoleCaoZuoBtn;
import com.tool.image.ImageMixDeal;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;


 

/**
 * 好友信息
 * @author Administrator
 *
 */
public class FriendMsgJpanel extends JPanel {

	private JLabel labTxk, // 头像框
			labTxkD, // 头像框
			labName, // 名字
			labCw, // 称谓
			labId, // ID
			labGrade, // 等级
			labZz, // 种族
			labGang; // 帮派

	private RoleCaoZuoBtn btnDj, // 断交
			btnLsxx, // 历史消息
			btnFsxx, //发送消息
			btnJy, //交易
			btnSqrd; //申请入队

	private Friendtable friend;
	public void show(Friendtable friend){
		this.friend=friend;
		labTxk.setIcon(new ImageIcon("img/head/"+friend.getSpecies_id()+".png"));
		labTxkD.setIcon(new ImageIcon("img/head/Ds"+friend.getSpecies_id()+".png"));
		labId.setText(friend.getRole_id().toString());
		labName.setText(friend.getRolename());
		labGrade.setText(AnalysisString.lvl(Integer.parseInt(friend.getGrade().toString()))+"级");
		labZz.setText(friend.getRace_name());
		labCw.setText("");
		labGang.setText("");
	}
	public FriendMsgJpanel() {
			this.setPreferredSize(new Dimension(590, 409));
			this.setLayout(null);
			this.setBackground(UIUtils.Color_BACK);

			// 关闭按钮事件
			FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 76);
			offBtn.setBounds(590-37, 10, 25, 25);
			this.add(offBtn);

			// 头像框
			labTxk = new JLabel("", SwingConstants.CENTER);
			labTxk.setBounds(50, 68, 75, 100);
			this.add(labTxk);

		labTxkD = new JLabel("",SwingConstants.CENTER);
		labTxkD.setBounds(344, 48, 218, 298);
		this.add(labTxkD);
			// 名字
			labName = new JLabel();
			labName.setBounds(210, 38, 115, 16);
			labName.setForeground(Color.WHITE);
			labName.setFont(UIUtils.TEXT_FONT1);
			this.add(labName);

			// 称谓
			labCw = new JLabel();
			labCw.setBounds(210, 65, 115, 16);
			labCw.setForeground(Color.WHITE);
			labCw.setFont(UIUtils.TEXT_FONT1);
			this.add(labCw);

			// ID
			labId = new JLabel();
			labId.setBounds(210, 85, 115, 16);
			labId.setForeground(Color.WHITE);
			labId.setFont(UIUtils.TEXT_FONT1);
			this.add(labId);

			// 等级
			labGrade = new JLabel();
			labGrade.setBounds(210, 107, 115, 16);
			labGrade.setForeground(Color.WHITE);
			labGrade.setFont(UIUtils.TEXT_FONT1);
			this.add(labGrade);

			// 种族
			labZz = new JLabel();
			labZz.setBounds(210, 130, 115, 16);
			labZz.setForeground(Color.WHITE);
			labZz.setFont(UIUtils.TEXT_FONT1);
			this.add(labZz);

			// 帮派
			labGang = new JLabel();
			labGang.setBounds(210, 180, 115, 16);
			labGang.setForeground(Color.WHITE);
			labGang.setFont(UIUtils.TEXT_FONT1);
			this.add(labGang);
//			"skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, "转换", 5
			// 断交
			btnDj = new RoleCaoZuoBtn("skin/8100226/newbutton/B30.png", 1, "断交", 8,UIUtils.COLOR_BTNTEXT);
			btnDj.setBounds(43, 36, 34, 17);
			this.add(btnDj);

			// 历史消息
			btnLsxx = new RoleCaoZuoBtn("skin/8100226/newbutton/B34.png", 1, "历史消息", 9,UIUtils.COLOR_BTNTEXT);
			btnLsxx.setBounds(54, 178, 68, 17);
			this.add(btnLsxx);
//			imageMap.getImgMap().get("B22"),"B22", 1, UIUtils.COLOR_BTNPUTONG, 5, "在线摆摊", this
			//发送消息
			btnFsxx = new RoleCaoZuoBtn("skin/8100226/newbutton/B22.png", 1, "发送消息", 10,UIUtils.COLOR_BLACK);
			btnFsxx.setBounds(49, 359, 99, 24);
			this.add(btnFsxx);
			
			//交易
			btnJy = new RoleCaoZuoBtn("skin/8100226/newbutton/B20.png", 1, "交易", 10,UIUtils.COLOR_BLACK);
			btnJy.setBounds(158, 359, 59, 24);
			this.add(btnJy); 
			
			//申请入队
			btnSqrd = new RoleCaoZuoBtn("skin/8100226/newbutton/B22.png", 1, "申请入队", 10,UIUtils.COLOR_BLACK);
			btnSqrd.setBounds(227, 359, 99, 24);
			this.add(btnSqrd);
	}

	private ImageIcon icon;

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
			// 好友列表
			if (icon == null) {
				icon = new ImageIcon("inkImg/newbackground/B329.png");
            }

			g.drawImage(icon.getImage(), 0, 0, 590, 409, this);
	}

	public JLabel getLabTxk() {
		return labTxk;
	}

	public void setLabTxk(JLabel labTxk) {
		this.labTxk = labTxk;
	}

	public JLabel getLabTxkD() {
		return labTxkD;
	}

	public void setLabTxkD(JLabel labTxkD) {
		this.labTxkD = labTxkD;
	}

	public JLabel getLabName() {
		return labName;
	}

	public void setLabName(JLabel labName) {
		this.labName = labName;
	}

	public JLabel getLabCw() {
		return labCw;
	}

	public void setLabCw(JLabel labCw) {
		this.labCw = labCw;
	}

	public JLabel getLabId() {
		return labId;
	}

	public void setLabId(JLabel labId) {
		this.labId = labId;
	}

	public JLabel getLabGrade() {
		return labGrade;
	}

	public void setLabGrade(JLabel labGrade) {
		this.labGrade = labGrade;
	}

	public JLabel getLabZz() {
		return labZz;
	}

	public void setLabZz(JLabel labZz) {
		this.labZz = labZz;
	}

	public JLabel getLabGang() {
		return labGang;
	}

	public void setLabGang(JLabel labGang) {
		this.labGang = labGang;
	}
	public Friendtable getFriend() {
		return friend;
	}
	public void setFriend(Friendtable friend) {
		this.friend = friend;
	}
	
}
